package com.zhangjq.simplefactory;

import com.zhangjq.common.IPay;

/**
 * Created by Administrator on 2019/3/9 0009.
 */
public class PayFactory3 {
    public IPay pay(Class<? extends IPay> clazz){
        if (clazz == null) return null;
        try {
            return clazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
